using System;
using Think.Problems;

namespace Think.Test.Problems
{
    public class FakeDeck : IDeck
    {
        private Deck _deck = new Deck();

        public int CalledCountGet = 0;
        public int CalledDraw = 0;
        public int CalledDrawWithCount = 0;
        public int CalledReturnToBottomWithCards = 0;
        public int CalledReturnToBottom = 0;

        /// <summary>
        /// Value of cards in this deck.
        /// </summary>
        public int Count
        {
            get
            {
                CalledCountGet++;
                return _deck.Count;
            }
        }

        /// <summary>
        /// Draw one card from this deck.
        /// </summary>
        /// <returns>Card code.</returns>
        public string Draw()
        {
            CalledDraw++;
            return _deck.Draw();
        }

        /// <summary>
        /// Draw the given number of cards from the deck (<paramref name="a_count"/>).
        /// </summary>
        /// <param name="a_count">Number of cards.</param>
        /// <returns>Cards drawn.</returns>
        public string[] Draw(int a_count)
        {
            CalledDrawWithCount++;
            return _deck.Draw(a_count);
        }

        /// <summary>
        /// Return the given cards (<paramref name="a_cards"/>) to the bottom of this deck if it is a valid card and 
        ///     does not already exist in this deck.
        /// </summary>
        /// <param name="a_cards">Cards to return.</param>
        /// <exception cref="ArgumentNullException">Thrown if "<paramref name="a_cards"/>" is null.</exception>
        public void ReturnToBottom(params string[] a_cards)
        {
            CalledReturnToBottomWithCards++;
            _deck.ReturnToBottom(a_cards);
        }

        /// <summary>
        /// Add the given card (<paramref name="a_card"/>) to the bottom of this deck if it is a valid card and does
        ///     not already exist in this deck.
        /// </summary>
        /// <param name="a_card"></param>
        public void ReturnToBottom(string a_card)
        {
            CalledReturnToBottom++;
            _deck.ReturnToBottom(a_card);
        }
    }
}